home *** CD-ROM | disk | FTP | other *** search
/ Danny Amor's Online Library / Danny Amor's Online Library - Volume 1.iso / html / faqs / faq / tcl-faq / tk.part1 < prev    next >
Encoding:
Text File  |  1995-07-25  |  59.3 KB  |  1,722 lines

  1. Subject: FAQ: comp.lang.tcl Tk Toolkit Usage Questions And Answers (1/1)
  2. Newsgroups: comp.lang.tcl,comp.answers,news.answers
  3. From: tja@cpu.com (Thomas J. Accardo)
  4. Date: Wed, 9 Nov 1994 17:17:51 GMT
  5.  
  6. Archive-name: tcl-faq/tk/part1
  7. Posting-Frequency: monthly
  8. Version: 1.2
  9. Last-modified: November 6, 1994
  10.  
  11.  
  12. This FAQ will address commonly asked questions about usage of the Tk
  13. Toolkit.  By providing answers to commonly asked questions in this
  14. document, it is hoped that new users of Tk may suffer less frustration
  15. getting started with Tk, and that readers of comp.lang.tcl may suffer
  16. less frustration reading/answering these questions repeatedly.
  17.  
  18. This FAQ is posted monthly to comp.lang.tcl, comp.answers, and
  19. news.answers and can also be obtained from the Tcl archive at
  20. ftp.aud.alcatel.com (198.64.191.10) in the /tcl/docs directory.
  21.  
  22. For additional information on Tcl as well as pointers to other
  23. documentation and code, see the FAQ maintained by Larry Virden
  24. (lvirden@cas.org):
  25.        "FAQ: comp.lang.tcl Frequently Asked Questions"
  26. which resides on ftp.aud.alcatel.com as /tcl/docs/tcl-faq.part0*.gz.
  27.  
  28. For information on usage of the Tcl programming language, see the
  29. posting by Joe Moss (joe@morton.rain.com):
  30.        "FAQ: comp.lang.tcl Tcl Language Usage Questions And Answers"
  31. which resides on ftp.aud.alcatel.com as /tcl/docs/tcl-faq-usage.gz.
  32.  
  33. Comments, suggestions, and contributions to this FAQ are welcomed
  34. at tja@cpu.com.
  35. ___________________________________________________________________________
  36.  
  37.  
  38. Index of questions:
  39.  
  40. I. Questions on building Tcl and friends on your system:
  41.     Q1A. Is there anywhere I can find help with the details of getting 
  42.         Tcl to work on my machine?
  43.     Q1B. Why does the link step says that some of the functions Tcl,
  44.         needs are missing when I am trying to build it?
  45.     Q1C. Has anyone built Tcl 6 on an RS/6000 AIX 3.1? 
  46.     Q1D. Has anyone gotten Tcl to compile under HP-UX?
  47.     Q1E. Has anyone gotten Tcl to compile under VMS?
  48.     Q1F. What does it take to get Tcl to compile under SCO Unix?
  49.     Q1G. Why do I get format and scan errors when I run tclTest
  50.         (NeXT, AIX, etc.)?
  51.     Q1H. Why do I get lots of errors under Irix 4.0.1 when I run
  52.         tclTest?
  53.     Q1I. Does anyone else have problems with Tcl on a Cray?
  54.     Q1J. Does anyone know how to get Tk to run on a SparcBook or other
  55.         laptop with a limited number of colors?
  56.     Q1K. What does it take to get Tcl/Tk to compile on 386bsd/Linux 
  57.         or other POSIX/ANSI C systems not already supported?
  58.     Q1L. Why do I get a parse error in tkInit.c when I try to compile
  59.         Tk on my Irix machine?
  60.     Q1M. What do I need to do to install Tcl 7.x/Tk 3.x on NeXTSTEP 3.1?
  61.     Q1N. Why can't I print the draft of the Tcl/Tk book?
  62.     Q1O. Why am I getting errors on my SGI Indigo workstation?
  63.     Q1P. How do I build expect on Solaris 2.3?
  64.     Q1Q. How do I add BLT to a TclX/Tk ?
  65.     Q1R. How do I port Tcl and Tk to a Sequent?
  66.     Q1S. Why do I get invalid command name when I start wish?
  67.     Q1T. How do I get around the symbol table full msg in A/UX?
  68.     Q1U. Why doesn't the Makefile generated from xmkmf work on my
  69.         SunOS system?
  70.     Q1V. How do I get Tcl to compile on my MS-DOS, MacOS, Amiga
  71.         or other micro system?
  72.     Q1W. How do I get Tcl to compile on my QNX system?
  73.  
  74. II.  Tk Questions and Answers - How can I:
  75.  
  76.     A. Question on starting Tk applications
  77.  
  78.     Q2.A.1. get my wish application to execute (I just get a wish prompt!)?
  79.     Q2.A.2. ,using a machine with less than 8 bit color, run?
  80.     Q2.A.3. set X11 resources for a wish application in an 
  81.         app-defaults file?
  82.     Q2.A.4. specify bitmap patterns on the command line instead of 
  83.         as a file name?
  84.     Q2.A.5. get a Motif user interface?
  85.     Q2.A.6. get an OpenLook user interface?
  86.     Q2.A.7. get Tk 3.3 to even start (I get security error messages)?
  87.     Q2.A.8. call Tk scripts from a C program?
  88.  
  89.     B. Questions on Tk applications and the keyboard
  90.  
  91.     Q2.B.1. change the default class bindings?
  92.     Q2.B.2. delete a binding?
  93.     Q2.B.3. change a binding while it is being executed?
  94.     Q2.B.4. bind the arrow key on my Sun keyboard?
  95.     Q2.B.5. get root's mouse bindings to work in my Tk application?
  96.     Q2.B.6. add new actions to an existing binding?
  97.  
  98.     C. Questions on Tk and X11 interactions
  99.  
  100.     Q2.C.1. get an application to also use libXt?
  101.     Q2.C.2. change the X11 cursor?
  102.     Q2.C.3. raise or lower a window?
  103.     Q2.C.4. re-map a withdrawn window id?
  104.     Q2.C.5. use Tk in a subwindow of a non-Tk X11 application?
  105.     Q2.C.6. bind <Enter> and <Leave> to a frame containing other widgets?
  106.     Q2.C.7. mix interactions between Xt and Tk/Tcl?
  107.     Q2.C.8. bind the ResizeRequest event?
  108.     Q2.C.9. avoid that 'bad geometry "+0+0": expected widthxheight'
  109.         error message?
  110.  
  111.     D. Questions on Tk listboxes
  112.  
  113.     Q2.D.1. resize a listbox?
  114.     Q2.D.2. select two items that are not adjacent in the listbox at 
  115.         one time?
  116.     Q2.D.3. select items in more than one Tk listbox at a time?
  117.     Q2.D.4. avoid fractional white space at the end of a resizable listbox?
  118.     Q2.D.5. scroll two listboxes with one scrollbar?
  119.  
  120.     E. Questions on Tk canvases
  121.  
  122.     Q2.E.1. get output from a Tk canvas?
  123.     Q2.E.2. fill a canvas which is bounded by lines as opposed to a
  124.         shape like a polygon, oval, etc.?
  125.     Q2.E.3. raise/lower canvas window objects or draw graphics onto a 
  126.         window object inside a canvas?
  127.     Q2.E.4. detect when the canvas has been resized?
  128.     Q2.E.5. scroll a canvas an a listbox at the same time with 
  129.         one scrollbar?
  130.  
  131.     F. Other questions
  132.  
  133.     Q2.F.1. get the name of my own interpreter?
  134.     Q2.F.2. get -relief to work on my text widgets?
  135.     Q2.F.3. create a scrollable window of buttons?
  136.     Q2.F.4. pack a text widget so that it can be resized interactively?
  137.     Q2.F.5. create a widget with an upper case name?
  138.     Q2.F.6. create equal sized buttons?
  139.     Q2.F.7. vertically stack radio buttons aligning regardless of font?
  140.     Q2.F.8. initialize an entry widget with some text?
  141.     Q2.F.9. change the default colors in Tk?
  142.     Q2.F.10. find my invisible windows when using the packer?
  143.  
  144. End of FAQ Index
  145.  
  146. ----------------------------------------------------------------------
  147.  
  148. ------------------------------
  149.  
  150. From: -I- Questions on building Tcl and friends on your system
  151. Subject: -Q1A- Is there anywhere I can find help with the details of 
  152.         getting Tcl to work on my machine?
  153.  
  154. A1A. Glad you asked!  Look in the Tcl distribution for the file called
  155. "porting.notes".  This will contain a collection of notes that various people
  156. have provided about porting Tcl to various machines and operating systems.
  157. There are also a file called "README" which should be read FIRST - before
  158. doing anything else with the code (this should always be one's first
  159. step with any package).  Finally, there is a "changes" file which details
  160. what has changed since the last release - be sure to read this to see
  161. what might need to change in your programs.
  162.  
  163. ------------------------------
  164.  
  165. From: -I- Questions on building Tcl and friends on your system
  166. Subject: -Q1B- Why does the link step says that some of the functions Tcl,
  167.         needs are missing when I am trying to build it?
  168.  
  169. A1B. Did you run the "config" program first, by doing a "csh ./config" or
  170. equivalent?  Without doing this, things such as strtoul or strerror
  171. are sometimes mentioned as missing.
  172.  
  173. Tcl includes equivalents for at least the following functions and include files
  174. which may not be found on some systems:
  175.  
  176. dirent.h       limits.h          stdlib.h         string.h
  177.  
  178. opendir.c      strerror.c     strstr.c         strtol.c        strtoul.c
  179.  
  180. strtod.c
  181.  
  182. ------------------------------
  183.  
  184. From: -I- Questions on building Tcl and friends on your system
  185. Subject: -Q1C- Has anyone built Tcl 6 on an RS/6000 AIX 3.1? 
  186.  
  187. A1C. See porting notes - especially the note about strtoul.
  188.  
  189. One user got Tcl to compile with a few minor source modifications
  190. (for example, duplicate case statements for errno and signal symbols in 
  191. tclUnixStr.c). 
  192.  
  193. A few other problems arose in the tests.  One is caused by AIX printf
  194. not formatting %#x and %#o correctly when the value to be printed is
  195. zero:  they print "0x0" and "00" instead of "0" and "0" respectively.
  196. This was reported as not a problem in earlier releases.  No fixes have
  197. been posted.
  198.  
  199. Finally, a problem occurs in open.test.  test 13.6 hangs because "cat"
  200. on the RS6000 is unbuffered.  A workaround is to change the execution
  201. of "cat" in open.test to do a "cat -u".
  202.  
  203. Dov Grobgeld <dov@menora.weizmann.ac.il> provided info on creating Tcl
  204. and Tk shared libraries under AIX 3.1.5:
  205.  
  206. For Tcl:
  207.  
  208. cc -o tkshar.o *.o -bE:tclshar.exp -bM:SRE -berok -lX11 -lm
  209. ar r libtclshr tclshar.o
  210.  
  211. For Tk:
  212.  
  213. cc -o tkshar.o *.o -bE:tkshar.exp -bM:SRE -berok -Ltcl -lX11 -lm -ltclshr
  214. ar r libtkshr tkshar.o
  215.  
  216. where tckshar.exp and tkshar.exp had lists of the external functions.
  217.  
  218. There are also problems with fonts on AIX and the IBM.  A patch is needed
  219. from IBM to fix the X server so that fonts are working
  220.  
  221. ------------------------------
  222.  
  223. From: -I- Questions on building Tcl and friends on your system
  224. Subject: -Q1D- Has anyone gotten Tcl to compile under HP-UX?
  225.  
  226. A1D. See the porting notes.  Also, be aware that there have been
  227. some reports of Configure assuming that you should use the compatibility
  228. version of opendir() and that you have no dirent.h .  This causes 
  229. glob-ing to fail, as well as TclX's readdir, etc.
  230.  
  231. Changing tcl7.3 to remove the opendir compatibility file
  232. and removing the -DNO_DIRENT, -DUSE_DIRENT2 fixed it all up.
  233.  
  234. ------------------------------
  235.  
  236. From: -I- Questions on building Tcl and friends on your system
  237. Subject: -Q1E- Has anyone gotten Tcl to compile under VMS?
  238.  
  239. A1E. Information from jkimball@src.honeywell.com (John Kimball) on
  240. May 4, 1993 was that he had gotten Tcl 6.7 and Tk 3.2 ported to VMS
  241. 5.5.  See the catalog for the file information.
  242.  
  243. ------------------------------
  244.  
  245. From: -I- Questions on building Tcl and friends on your system
  246. Subject: -Q1F- What does it take to get Tcl to compile under SCO Unix?
  247.  
  248. A1F. Add a "#undef select" to tkEvent.c, and remove the reference to 
  249. TK_EXCEPTION around line 460 of main.c.
  250.  
  251. Tk uses its own scheme for allocating the border colors for its 3D
  252. widgets, which causes problems when running TK on a system with
  253. "PseudoColor" display class, and a 16-cell colormap.
  254.  
  255. If you can't go to eight bitplanes, you can instead start the server
  256. with a "-static" (Xsco) or "-analog" (Xsight) option, making the
  257. display class become "StaticColor".  This makes the entire colormap
  258. read-only, and it will return the color that most closely maps to the
  259. desired color as possible.
  260.  
  261. This information is from Keith Amann <Keith_Amann@stortek.com>
  262.  
  263. ------------------------------
  264.  
  265. From: -I- Questions on building Tcl and friends on your system
  266. Subject: -Q1G- Why do I get format and scan errors when I run tclTest
  267.         (NeXT, AIX, etc.)?
  268.  
  269. A1G. That's a problem (scanf/printf) many systems seem to have.  Don't
  270. worry too much about it - just don't use these 'advanced' features.  If
  271. you're hacking C, you'll have the same problems.
  272.  
  273. For instanct, printf("%Ng, double_value) and strtod("+",&terminal) produce
  274. incorrect results.
  275.  
  276. ------------------------------
  277.  
  278. From: -I- Questions on building Tcl and friends on your system
  279. Subject: -Q1H- Why do I get lots of errors under Irix 4.0.1 when I run
  280.         tclTest?
  281.  
  282. A1H. There's a bug in the 4.0.1 optimizer that's fixed in 4.0.2.
  283. Compile tclVar.c using -O0 (no optimization).
  284.  
  285. ------------------------------
  286.  
  287. From: -I- Questions on building Tcl and friends on your system
  288. Subject: -Q1I- Does anyone else have problems with Tcl on a Cray?
  289.  
  290. A1I. See the porting notes for a set of changes mentioned.  Also,
  291. Booker C. Bense <benseb@grumpy.sdsc.edu> reports that version 3.0.1.6
  292. has some real problems with char pointers, causing Tcl to crash.  Using
  293. version 3.0.2.1, things are much better, except for a minor formatting
  294. problem and serious problems with scan.
  295.  
  296. ------------------------------
  297.  
  298. From: -I- Questions on building Tcl and friends on your system
  299. Subject: -Q1J- Does anyone know how to get Tk to run on a SparcBook or other
  300.         laptop with a limited number of colors?
  301.  
  302. A1J. On a SparcBook, if you start openwin (the OpenWindows server starting
  303. command) as:
  304.  
  305. openwin -dev "/dev/fb staticvis"
  306.  
  307. you get a static visual color model that Tk copes with better than the
  308. default.  Some things are ugly, but not as ugly as monochrome.
  309.  
  310. ------------------------------
  311.  
  312. From: -I- Questions on building Tcl and friends on your system
  313. Subject: -Q1K- What does it take to get Tcl/Tk to compile on 386bsd/Linux 
  314.         or other Posix/ANSI C systems not already supported?
  315.  
  316. A1K. Patches for 386BSD were posted to comp.lang.tcl back in Nov. 1992 to
  317. alt.sources.  See one of the ftp archive sites for this group for them.
  318. Basically, there were some setting of defines and a few places where 
  319. const char * had to be used in place of char *.  
  320.  
  321. ------------------------------
  322.  
  323. From: -I- Questions on building Tcl and friends on your system
  324. Subject: -Q1L- Why do I get a parse error in tkInit.c when I try to compile
  325.         Tk on my Irix machine?
  326.  
  327. A1L. Jon Knight <J.P.Knight@loughborough.ac.uk> reports that the version of
  328. Irix that he is using doesn't define a uid_t.  One needs to define one 
  329. somewhere (or comment out the lines causing the problems) to get the compile
  330. to continue.
  331.  
  332. ------------------------------
  333.  
  334. From: -I- Questions on building Tcl and friends on your system
  335. Subject: -Q1M- What do I need to do to install Tcl 7.1/Tk 3.4 on NeXTSTEP 3.1?
  336.  
  337. A1M.  I have indicated in the past that this particular question seems
  338. to generate controversy - I have replaced previous explanations with the
  339. latest msg from someone who sounds authoritative...
  340.  
  341. From: Robert Nicholson <robert@steffi.demon.co.uk>
  342.  
  343. This is for TCL7.1 and TK3.4 
  344.  
  345. This is a variation on Thomas Funke's entry.
  346.  
  347. Installing TCL7.1 on NeXT
  348. =========================
  349.  
  350. To install tcl7.1 on NeXTSTEP 3.1 you must:
  351.  
  352. - run configure with predefined CPP:
  353.     type "sh" to run a Bourne shell.
  354.     then type
  355.     CPP='cc -E' ./configure
  356.  
  357. - edit Makefile:
  358.  
  359.   add tmpnam.o to COMPAT_OBJS:
  360.   COMPAT_OBJS =      getcwd.o waitpid.o strtod.o tmpnam.o
  361.  
  362. At this point you probably want to rename the all calls to strtod and
  363. tmpnam to something else in order to distinguish them from those that
  364. are supplied in the NeXT libraries libsys_a.a.  You can do this by 
  365. adding the following line to AC_FLAGS
  366.  
  367.     -Dstrtod=newstrtod -Dtmpnam=newtmpnam
  368.  
  369. and renaming the names of the definitions in the appropriate
  370. compat/*.c files.
  371.  
  372. To check everything is working correctly open a tclsh 
  373.  
  374. % expr {"0" == "+"} 
  375. 0
  376.  
  377. Using the wrong strtod function will cause this test to return 1 which
  378. is a serious error.  Ignore the precision errors.
  379.  
  380. Installing TK3.4 on NEXTSTEP 3.1
  381. ================================
  382.  
  383. There is a call to strtod in TK3.4 so you should link against
  384. ../tcl-7.1/compat/strtod.o and apply the -Dstrtod=newstrtod
  385. to AC_FLAGS in Tk also.
  386.  
  387. Note:Tk's raise test will fail when running the tvtwm window manager.
  388. Changing to either twm or even better fvwm ensures that this test will
  389. succeed. 
  390.  
  391. ------------------------------
  392.  
  393. From: -I- Questions on building Tcl and friends on your system
  394. Subject: -Q1N- Why can't I print the draft of the Tcl/Tk book?
  395.  
  396. A1N.  From ouster@cs.Berkeley.EDU (John Ousterhout):
  397.  
  398. Here's my form letter that seems to explain most of the problems people
  399. have had printing parts of the book:
  400.  
  401. Some old versions of the Transcript spooler software cannot properly
  402. handle encapsulated Postscript files within another Postscript file
  403. when they do page reversal.  They tend to garble the page structure of
  404. the file, causing an error at the point of the first EPS file.  Part
  405. II of the Tcl book has lots of EPS files embedded in it, one for
  406. each screen dump.  If your printer cannot print this file I suggest
  407. checking to see if page reversal is enabled for your printer.  If
  408. so, try asking your local system wizard to disable it for you;  this
  409. should allow the file to print.  Or, find some other way to dump the
  410. Postscript file directly to the printer without going through the
  411. spooling software (e.g. perhaps you can simply cat it to the printer's
  412. serial port).
  413.  
  414. Others have suggested:
  415.  
  416.  The embedded pictures have CR as the line separator instead of LF and
  417.  this may be causing the problem. Try translating them to LFs ...
  418.  
  419.    tr '\015' '\012' <book.p2.ps >fixedbook.p2.ps
  420.  
  421. and:
  422.  
  423.  This is not the original poster's problem but in countries using A4
  424.  paper and on a particular printer, the Dataproducts LZR1260E, the frame
  425.  size causes the printing to be stretched vertically. This happens with
  426.  other Framemaker generated documents by the way. A PS interpreter bug
  427.  no doubt. The fix is to edit the dimensions for A4 paper. This shell
  428.  script does both fixes.
  429.  
  430. #!/bin/sh
  431. cat $1 | tr '\015' '\012' | sed '/FMDOCUMENT$/s/612 792/595 842/'
  432.  
  433. ------------------------------
  434.  
  435. From: -I- Questions on building Tcl and friends on your system
  436. Subject: -Q1O- Why am I getting errors on my SGI Indigo workstation?
  437.  
  438. A1O. From Gordon Lack <gml4410@ggr.co.uk> we are told that
  439. the SGI c compiler has some bugs with variable arguments.
  440.  
  441. tclVar.c must be compiled with -O0 at IRIX C 4.0.1 because of a
  442. compiler bug with varargs.
  443.  
  444.    Done by placing specific rule into Makefile.
  445.  
  446. > # GGR SG needs -O0 for varargs at 4.0.1
  447. >
  448. > CC_SWITCHES0 =  -O0 -I. -I${SRC_DIR} ${AC_FLAGS} ${MATH_FLAGS} \
  449. > ${GENERIC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \
  450. > -DTCL_LIBRARY=\"${TCL_LIBRARY}\"
  451. >
  452. > tclVar.o: tclVar.c
  453. >         $(CC) -c $(CC_SWITCHES0) $<
  454.  
  455. Peter NEELIN <neelin@pet.mni.mcgill.ca> also noted that:
  456.  
  457. I get tclX 7.3a to compile on an SGI (irix 4.0.5) with the following
  458. changes to the Config.mk file:
  459.  
  460. 71c71
  461. < CFLAGS=-cckr -D__GNU_LIBRARY__
  462. ---
  463. > #CFLAGS=
  464. 106,107c106,107
  465. < TCL_PLUS_BUILD=TCL_PLUS
  466. < CCPLUS=g++
  467. ---
  468. > #TCL_PLUS_BUILD=TCL_PLUS
  469. > CCPLUS=CC
  470. 191,193c191
  471. < MAN_DIR_SEPARATOR=
  472. < LIBOBJS=strftime.o
  473. ---
  474. > #MAN_DIR_SEPARATOR=.
  475.  
  476. The -D__GNU_LIBRARY solves the srandom problem and I think that the -cckr gets
  477. around the prototype error with waitpid (it's crude, but it works).
  478. I've forgotten why I needed the strftime.
  479.  
  480. If you want the version of Config.mk that worked for me, send me mail.
  481.  
  482. ------------------------------
  483.  
  484. From: -I- Questions on building Tcl and friends on your system
  485. Subject: -Q1P- How do I build expect on Solaris 2.3?
  486.  
  487. A1P. From jra@hrcms.jazz.att.com (Jeff Abramson) we are told that,
  488.  
  489. > using either SunPro cc 2.0.1 or gcc 2.5.8 with
  490. > no problems.  For SunPro I do:
  491. >  
  492. >         CC=cc ./configure --prefix=directory_of_your_choice
  493. >         make CC=cc
  494. >  
  495. > For gcc I do:
  496. >  
  497. >         CC="gcc -fwritable-strings" ./configure \
  498. >        --prefix=directory_of_your_choice
  499. >        make CC="gcc -fwritable-strings"
  500.  
  501. ------------------------------
  502.  
  503. From: -I- Questions on building Tcl and friends on your system
  504. Subject: -Q1Q- How do I add BLT to a TclX/Tk ?
  505.  
  506. A1Q. From gah@grenache.mhcnet.att.com (George A. Howlett) we get
  507. the answer:
  508.  
  509. Instead of adding TclX to blt_wish, try it the other way.  Add
  510. BLT to wishx.  It's pretty simple.
  511.  
  512. In the file ./tksrc/tkXAppInit.c, add the a call to the BLT
  513. initialization routine right after line 116.
  514.  
  515.     if (TkX_Init(interp) == TCL_ERROR) {
  516.         return TCL_ERROR;
  517.     }
  518.     if (Blt_Init(interp) != TCL_OK)) {
  519.         return TCL_ERROR;
  520.     }
  521.  
  522. Link wishx with libBLT.a and that's it.
  523.  
  524. Others recommend the tkmkmf or make-a-wish packages.
  525.  
  526. ------------------------------
  527.  
  528. From: -I- Questions on building Tcl and friends on your system
  529. Subject: -Q1R- How do I port Tcl and Tk to a Sequent?
  530.  
  531. A1R.  From Andrew Swan <aswan@soda.berkeley.edu> we find:
  532.  
  533. > For both Tcl and Tk, I used gcc rather than the Sequent cc which is
  534. > not ansi.
  535. > For Tcl, there were a couple of problems with the math library.  First,
  536. > the Sequent math library doesn't include the 'fmod' function.  I got
  537. > the source for fmod from ftp.uu.net, put it in the compat subdirectory,
  538. > and added it to the Makefile.  fmod also wanted functions 'isnan' and
  539. > 'finite' but I just commented those out since I don't believe tcl
  540. > supports infinity and nan.
  541. > The other problem with the math library was that it has two copies
  542. > of the 'tanh' function in it.  This is easy to fix by using "ar"
  543. > to separate the library in to object files and then reconstruct
  544. > it, leaving one of the copies of tanh out.
  545. > With those changes, Tcl compiled cleanly and passed all the tests
  546. > except the scanning tests.  Apparently, the *scanf functions are
  547. > broken in Dynix.  The problem is with recognizing the end of octal
  548. > numbers, and I just let this problem go.  Fixing it would probably
  549. > involve finding source to the *scanf functions and including it.
  550. > To compile Tk, I had to make a new version of stddef.h including
  551. > things like wchar_t.  I just copied it in to another include directory
  552. > and put that directory first and then tweaked the copy.  Tk also had
  553. > the math library problem (tanh).  Other than those, however, everything
  554. > compiled cleanly and passed all the tests.
  555.  
  556. ------------------------------
  557.  
  558. From: -I- Questions on building Tcl and friends on your system
  559. Subject: -Q1S- Why do I get invalid command name when I start wish?
  560.  
  561. A1S. Often when folks trying to build a new version of wish get done
  562. and try to start it up, they get errors such as:
  563.  
  564. >$ /projects/xopsrc/wishx3.6a            
  565. >Error: invalid command name "tk_bindForTraversal"
  566. >invalid command name "tk_bindForTraversal"
  567. >    while executing
  568. >"tk_bindForTraversal Entry"
  569. >    (file "/projects/xopsrc/Tclsrc/v7/lib/3.6a/tk.tcl" line 98)
  570. >    invoked from within
  571. >"source $tk_library/tk.tcl"
  572. >    invoked from within
  573. >"if [file exists $tk_library/tk.tcl] {
  574. >            source $tk_library/tk.tcl
  575. >        } else {
  576. >            set msg "can't find $tk_library/tk.tcl; perhaps you "
  577. >            append  ..."
  578. >
  579.  
  580. The _real_ problem is, in all likelihood, that they do not have
  581. something either configured or installed properly.  If the command name
  582. is really valid, then auto_path isn't set right, an external variable
  583. pointing to the directories is overriding the default location, or things
  584. didn't install.
  585.  
  586. ------------------------------
  587.  
  588. From: -I- Questions on building Tcl and friends on your system
  589. Subject: -Q1T- How do I get around the symbol table full msg in AU/X 3.0?
  590.  
  591. A1S. After getting things compiled on AU/X, you have to be sure
  592. to do the links with the -A {factor} arguments which expand the default
  593. table allocations.  {factor} is the amount by which the compiler multiplies
  594. the default allocation.  Try -A 2.  Contact
  595. wkulecz@medics.jsc.nasa.gov (Walter B. Kulecz, PhD.) for more details
  596. of his port.
  597.  
  598. ------------------------------
  599.  
  600. From: -I- Questions on building Tcl and friends on your system
  601. Subject: -Q1U- Why doesn't the Makefile generated from xmkmf work on my
  602.         SunOS system?
  603.  
  604. A1U. There are numerous problems users have reported when trying to use the
  605. imake / xmkmf setup under OpenWindows.  Try asking over on comp.sys.sun.*
  606. for more assistance on resolving this problem.  Note also that the problem
  607. _might_ be someone expecting X11R6 imake rules to be present - if after
  608. fixing all the known bugs in the imake templates, etc. you still have
  609. problems, investigate that!
  610.  
  611. ------------------------------
  612.  
  613. From: -I- Questions on building Tcl and friends on your system
  614. Subject: -Q1V- How do I get Tcl to compile on my MS-DOS, MacOS, Amiga
  615.         or other micro system?
  616.  
  617. A1V. (see "tcl-faq/part01") or (see "tcl-faq/part04") for details concerning
  618. tools, finished ports, or mailing lists relating to this topic.
  619.  
  620. ------------------------------
  621.  
  622. From: -I- Questions on building Tcl and friends on your system
  623. Subject: -Q1W- How do I get Tcl to compile on my QNX system?
  624.  
  625. A1W. Steve Furr <furr@qnx.com> indicates:
  626.  
  627. For the record, to get TCL to work under QNX, I had to:
  628.  
  629.   o Make the _POSIX_SOURCE change indicated for pathname lengths
  630.   o Change a definition of VARARGS, so the Watcom ANSI C compiler
  631.     would accept varargs functions used.
  632.   o Resolve a conflict with error codes defined by QNX.
  633.  
  634.  
  635. ------------------------------
  636.  
  637. From: -II-  Tk Questions and Answers - How can I:
  638. Subject: -Q2.A.1- get my wish application to execute - I just get a
  639.         wish prompt!  Or I just get error msgs about permission
  640.         denied, not found, etc.
  641.  
  642. A2.A.1. Most systems require a full pathname to the interpreter.  
  643. So you cannot start a wish script out as 
  644.  
  645. #! wish -f
  646.  
  647. Likewise, many Unix systems have a maximum length of characters that you can
  648. put on a #! line.  If you exceed this, you do not get the behaviour you
  649. expect.  So do not try to put something like:
  650.  
  651. #! /projects/somethingbig/bin/sun4/wish -f
  652.  
  653. followed by your wish code.  Keep the lines short - under 32 characters is
  654. recommended.
  655.  
  656. Finally, on some machines, white space after the -f causes a problem.  Be
  657. sure that the -f are the last characters on the first line of the file.
  658.  
  659. Another trick that has been discussed has been putting the following line
  660. as line 1 of the shell file:
  661.  
  662. /usr/ucb/tail +2 $0 | /usr/local/bin/dpwish -notk $* ; exit
  663.  
  664. where you would replace /usr/local/bin/dpwish with whatever pathname
  665. your wish needed.
  666.  
  667. Another trick that has been suggested (and attributed to Eric Schenk) is
  668. #!/usr/local/bin/wish -f
  669. # The next line is a comment in Tcl, but not sh \
  670.         exec /usr/local/bin/wish $0 -f ${1+"$@"}
  671.  
  672. Other users report symptoms such as an empty wish window without
  673. widgets.  This still turns out to be a too long interpreter path.
  674.  
  675. ------------------------------
  676.  
  677. From: -II-  Tk Questions and Answers - How can I:
  678. Subject: -Q2.A.2- ,using a machine with less than 8 bit color, run?
  679.  
  680. A2.A.2. Tk doesn't behave very well with less than 8-bit color screens.  To
  681. try to use it, find all the places in the Tk/wish source where 
  682. DefaultDepthOfScreen is invoked to test the number of bit-planes.  Change all
  683. of these to pretend there is just 1 bit-plane, or call a procedure which
  684. monitors a Tcl variable so that it is configurable, and you should be okay.
  685.  
  686. Another alternative is to see if the server you are using has alternative
  687. visual / color models, such as static visual, etc.  One of the alternatives
  688. may allow Tk to work better.
  689.  
  690. Thanks to "Nathaniel Borenstein" <nsb@thumper.bellcore.com> for this info!
  691.  
  692. ------------------------------
  693.  
  694. From: -II-  Tk Questions and Answers - How can I:
  695. Subject: -Q2.A.3- set X11 resources for a wish application in an 
  696.         app-defaults file?
  697.  
  698. A2.A.3. Read the documentation for the option command.
  699. Then you should consider something like the following - assume the program
  700. name is xwf.
  701.  
  702. The following are two general purpose functions to put into a library:
  703.  
  704. # envVal envValName
  705. #   Looks up the envValName environment variable and returns its
  706. #   value, or {} if it does not exists
  707. proc envVal {envValName} {
  708.   global env
  709.   if [info exists env($envValName)] {return $env($envValName)} {return {}}
  710. }
  711.  
  712. # loadAppDefaults classNameList ?priority?
  713. #   Searches for the app-default files corresponding to classNames in
  714. #   the order specified by X Toolkit Intrinsics, and loads them with
  715. #   the priority specified (default: startupFile).
  716. proc loadAppDefaults {classNameList {priority startupFile}} {
  717.   set filepath "[split [envVal XUSERFILESEARCHPATH] :] \
  718.         [envVal XAPPLRESDIR] \
  719.         [split [envVal XFILESEARCHPATH] :] \
  720.         /usr/lib/X11"
  721.   foreach i $classNameList {
  722.     foreach j $filepath {
  723.       if {[file exists $j/$i]} {
  724.     option readfile $j/$i $priority; break
  725.       }
  726.     }
  727.   }
  728. }
  729.  
  730. # Now, here is what you would put into xwf:
  731.  
  732. option add Tk.BoldFont "*-lucida sans-Bold-R-Normal-*-100-*" widgetDefault
  733. loadAppDefaults {xwf XWF} userDefault
  734.  
  735. This sets a program default, then load any defaults specified in the user's
  736. default resources and finally any site or general app-defaults resource.  
  737. Of course, you would want to add some xwf command line handling to allow 
  738. the user to override things at execution time.
  739.  
  740. Chris Milam (address unknown) contributes the following modification
  741. of loadAppDefaults which follows the X11R5 method of merging
  742. app-default files from several sources.
  743.  
  744. # loadAppDefaults classNameList ?priority?
  745. #   Searches for the app-default files corresponding to classNames in
  746. #   the order specified by X Toolkit Intrinsics (R5), and loads them with
  747. #   the priority specified (default: startupFile).
  748. proc loadAppDefaults {classNameList {priority startupFile}} {
  749.   set lang [envVal LANG]
  750.   if {[string length $lang] > 0} { set lang /$lang }
  751.   set filepath "\
  752.                 /usr/lib/X11${lang}/app-defaults \
  753.                 [split [envVal XFILESEARCHPATH] :] \
  754.                 [envVal XAPPLRESDIR]${lang} \
  755.                 [split [envVal XUSERFILESEARCHPATH] :] \
  756.                 "
  757.   foreach i $classNameList {
  758.     foreach j $filepath {
  759.       if {[file exists $j/$i]} {
  760.         option readfile $j/$i $priority;
  761.       }
  762.     }
  763.   }
  764. }
  765.  
  766. ------------------------------
  767.  
  768. From: -II-  Tk Questions and Answers - How can I:
  769. Subject: -Q2.A.4- specify bitmap patterns on the command line instead of 
  770.         just as a file name?
  771.  
  772. A2.A.4. You can not, using unextended Tk, at least as of June, 1992,
  773. provide a pattern as an internal set of hex codes.  You must point to
  774. an external file.  On the other hand, there are extensions which provide
  775. the capability (BLT for one)>
  776.  
  777. ------------------------------
  778.  
  779. From: -II-  Tk Questions and Answers - How can I:
  780. Subject: -Q2.A.5- get a Motif user interface?
  781.  
  782. A2.A.5. Tk does not currently use the Xt toolkit, so a strict adherence
  783. to Motif via the libXm.a routines is not possible.  However, the authors
  784. of Tk prefer the Motif style of user interface, so you will find that Tk
  785. makes quite an attempt to implement a Motif-like interface.
  786.  
  787. ------------------------------
  788.  
  789. From: -II-  Tk Questions and Answers - How can I:
  790. Subject: -Q2.A.6- get an OpenLook user interface?
  791.  
  792. A2.A.6. Unfortunately, Tk does not currently use either XView or Xt based
  793. widgets in its user interface, so an OpenLook compliant (or even
  794. similar) interface is probably not easily achievable in the near future.
  795.  
  796. ------------------------------
  797.  
  798. From: -II-  Tk Questions and Answers - How can I:
  799. Subject: -Q2.A.7- get Tk 3.3 to even start - I get security error messages.
  800.  
  801. A2.A.7.  Alternate forms of this question often mention that Tk 3.3 send
  802. is broken, or ask how to use xauth.
  803.  
  804. Under Tk 3.3, the X11 xauth security mechanism is used.  While this
  805. provides more security, it does require the user to do a bit more
  806. setup.  The user needs to create an Xauthority file (typically
  807. $HOME/.Xauthority) and then restart the X server with the
  808. -auth argument, along with the name of the Xauthority file created.
  809. Read the X11 documentation for your system for the details on how to
  810. use xauth or comparable software to create the authority files needed.
  811. An intro to xauth is available as
  812. ftp://ftp.aud.alcatel.com/tcl/docs/Xauthority .
  813.  
  814. Also note that you can configure Tk to not depend on xauth by modifying
  815. the tk3.3/Makefile.in to comment out the following:
  816.  
  817. # To turn off the security checks that disallow incoming sends when
  818. # the X server appears to be insecure, reverse the comments on the
  819. # following lines:
  820. #SECURITY_FLAGS =
  821. SECURITY_FLAGS = -DTK_NO_SECURITY
  822.  
  823. ------------------------------
  824.  
  825. From: -II-  Tk Questions and Answers - How can I:
  826. Subject: -Q2.A.8- call Tk scripts from a C program?
  827.  
  828. A2.A.8.   Several simple examples have been posted to comp.lang.tcl
  829. recently.  Eric Bleeker <ericbl@paramount.nikhefk.nikhef.nl> was 
  830. gracious enough to package his up and place it at
  831. ftp://ftp.aud.alcatel.com/tcl/code/tkHelloWorld* .  This
  832. program assumes that you have installed the Tcl and Tk libraries , 
  833. header files, etc.
  834.  
  835. ------------------------------
  836.  
  837. From: -II-  Tk Questions and Answers - How can I:
  838. Subject: -Q2.B.1- change the default class bindings?
  839.  
  840. A2.B.1. All default class bindings for Tk widgets are initialized in
  841. $tk_library/tk.tcl.  Use this file as a guide to implement new
  842. bindings.  For instance, the following code duplicates Button 1's
  843. drag-select facility in Button 3 for all listboxes:
  844.  
  845. bind Listbox <3> {%W select from [%W nearest %y]}
  846. bind Listbox <B3-Motion> {%W select to [%W nearest %y]}
  847.  
  848. ------------------------------
  849.  
  850. From: -II-  Tk Questions and Answers - How can I:
  851. Subject: -Q2.B.2- delete a binding?
  852.  
  853. A2.B.2. Give an empty-string command to the "bind" invocation.  For
  854. example, to disable the Delete key in all entry fields:
  855.  
  856.     bind Entry <Delete> {}
  857.  
  858. ------------------------------
  859.  
  860. From: -II-  Tk Questions and Answers - How can I:
  861. Subject: -Q2.B.3- change a binding while it is being executed?
  862.  
  863. A2.B.3. As of June, 1992, this was not a safe thing to do in Tk.  It was
  864. put on the bug list by John Ousterhout to be fixed in a future version.
  865.  
  866. The solution for now is not to change the bindings, but to change
  867. something in the code they execute.  For example, keep a state variable
  868. that indicates which binding you'd like, but always have the binding
  869. call a given procedure.  Then that procedure checks the variable and
  870. executes one piece of code or another.  Or, you could just make the
  871. binding's command "eval $cmd" and then change the variable "cmd"
  872. depending on your application's state.
  873.  
  874. ------------------------------
  875.  
  876. From: -II-  Tk Questions and Answers - How can I:
  877. Subject: -Q2.B.4- bind the arrow key on my Sun keyboard?
  878.  
  879. A2.B.4. You have to call it <Left> rather than <R10>.  Under X11, keys are
  880. referred to by their keysym.  One can use either xmodmap -pk or the xev
  881. program to determine what the keysym a particular key on a keyboard is
  882. currently generating.
  883.  
  884. If the keysym that is being used is not known by Tk, you may have to edit
  885. its ks_names.h file.  There is a note in this file that indicates that
  886. one should not edit it - but this is where the keysym must be for it to
  887. be recognized.
  888.  
  889. Thanks to Wayne Christopher <faustus@CS.Berkeley.EDU> for this
  890. note.
  891.  
  892. ------------------------------
  893.  
  894. From: -II-  Tk Questions and Answers - How can I:
  895. Subject: -Q2.B.5- get root's mouse bindings to work in my Tk application?
  896.  
  897. A2.B.5. Some window managers, such as mwm, define mouse button bindings
  898. which cause Tk some problems.  Try saving off the window manager's startup
  899. file (something like /.mwmrc for instance) and then copy in a startup
  900. file from a login id that works.  Thanks to brad@NeoSoft.com (Brad Morrison)
  901. for this invaluable tip!
  902.  
  903. ------------------------------
  904.  
  905. From: -II-  Tk Questions and Answers - How can I:
  906. Subject: -Q2.B.6- add new actions to an existing binding?
  907.  
  908. A2.B.6. The question was actually:
  909. >I want to bind a text window so that any keypress in that window
  910.    >updates the window's title bar.  This is what I used:
  911.    >    
  912.    >    text .textWin ...
  913.    >    bind .textWin <Any-KeyPress> {+wm title . "Nextedit - edited"}
  914.    >
  915.    >This is supposed to let the user know that the text in the window
  916.    >has been edited.  The problem is the "+".  Where does it go?  Ive
  917.    >tried a bunch of things and it always ends up with either parse 
  918.    >errors or the wm command completely overrides the binding and does
  919.    >not allow any text entry.  I need to add the new binding to the
  920.    >current ones so that a keypress enters the text *and* updates the
  921.    >titlebar.  How?
  922.    >
  923.  
  924. gwl@cpu.com (Gerald W. Lester) replied:
  925.  
  926.    You need to move the class specific binding down to the widget specific
  927.    binding.  Try this:
  928.  
  929.        bind .textWin <Any-KeyPress> Text
  930.        bind .textWin <Any-KeyPress> {+wm title . "Nextedit - edited"}
  931.  
  932. ------------------------------
  933.  
  934. From: -II-  Tk Questions and Answers - How can I:
  935. Subject: -Q2.C.1- get an application to also use libXt?
  936.  
  937. A2.C.1. Tk2.1 and Xt have different X connections, and XtAppNextEvent will
  938. block is there is nothing coming from the X connection.  One way
  939. of fixing this is get the connection number of Tk using
  940.  
  941.    ConnectionNumber(Tk_Display(tk_window));
  942.  
  943. and using XtAddInput to register this with the Xt event handler.  The
  944. callback procedure for XtAddInput wrapper procedure that runs
  945. Tk_OneEvent(1).  There might be problems with Tk file sources which
  946. aren't registered with Xt.
  947.  
  948. Thanks to joe@astro.as.utexas.edu (Joe Wang) for this information.
  949.  
  950. ------------------------------
  951.  
  952. From: -II-  Tk Questions and Answers - How can I:
  953. Subject: -Q2.C.2- change the X11 cursor?
  954.  
  955. A2.C.2. Here is a tip from mgc@cray.com (M. G. Christenson).
  956.  
  957. Look at /usr/include/X11/cursorfont.h for a list of available cursors.
  958. You can use the names in there by removing the 'XC_'.  
  959.  
  960. Here's a little proc I use to make my entire application go 'busy'
  961. while it's doing something. Just call it with the commands you want to
  962. execute, and the watch cursor will be displayed for the time it takes
  963. the commands to complete.  Note that any new windows will have their
  964. normal cursor.
  965.  
  966. proc busy {cmds} {
  967.     global errorInfo
  968.  
  969.     set busy {.app .root}
  970.     set list [winfo children .]
  971.     while {$list != ""} {
  972.     set next {}
  973.     foreach w $list {
  974.         set class [winfo class $w]
  975.         set cursor [lindex [$w config -cursor] 4]
  976.         if {[winfo toplevel $w] == $w || $cursor != ""} {
  977.         lappend busy [list $w $cursor]
  978.         }
  979.         set next [concat $next [winfo children $w]]
  980.     }
  981.     set list $next
  982.     }
  983.  
  984.     foreach w $busy {
  985.     catch {[lindex $w 0] config -cursor watch}
  986.     }
  987.  
  988.     update idletasks
  989.  
  990.     set error [catch {uplevel eval [list $cmds]} result]
  991.     set ei $errorInfo
  992.  
  993.     foreach w $busy {
  994.     catch {[lindex $w 0] config -cursor [lindex $w 1]}
  995.     }
  996.  
  997.     if $error {
  998.     error $result $ei
  999.     } else {
  1000.     return $result
  1001.     }
  1002. }
  1003.  
  1004. ------------------------------
  1005.  
  1006. From: -II-  Tk Questions and Answers - How can I:
  1007. Subject: -Q2.C.3- raise or lower a window?
  1008.  
  1009. A2.C.3. This is on the (semi-infinite) list of things to be done in the future.
  1010. If you have the time, please go ahead and add it and submit the code and all
  1011. will be grateful.
  1012.  
  1013. ------------------------------
  1014.  
  1015. From: -II-  Tk Questions and Answers - How can I:
  1016. Subject: -Q2.C.4- re-map a withdrawn window id?
  1017.  
  1018. A2.C.4. Use wm deiconify <windowid>.
  1019.  
  1020. ------------------------------
  1021.  
  1022. From: -II-  Tk Questions and Answers - How can I:
  1023. Subject: -Q2.C.5- use Tk in a subwindow of a non-Tk X11 application?
  1024.  
  1025. A2.C.5. From faustus@CS.Berkeley.EDU (Wayne A. Christopher):
  1026.  
  1027. [C]reate the Tk toplevel window but don't map it (wm withdraw).  Then
  1028. re-parent the window to be a subwindow of your other one and then map
  1029. it.  I have done this when the Tk application is a separate process,
  1030. but if it's the same process I think you will get into trouble with the
  1031. event loop, since each toolkit wants control.
  1032.  
  1033. ------------------------------
  1034.  
  1035. From: -II-  Tk Questions and Answers - How can I:
  1036. Subject: -Q2.C.6- bind <Enter> and <Leave> to a frame containing 
  1037.     other widgets?
  1038.  
  1039. A2.C.6. From John Ousterhout, ouster@cs.Berkeley.EDU):
  1040.  
  1041. Each <Enter> or <Leave> event has a "detail" field, which you can access
  1042. from bindings with "%d".  If the detail is "NotifyInferior" it means the
  1043. pointer has moved into or out of a child window (so it's really still in
  1044. the area of the window receiving the event).  You should be able to check
  1045. the detail in your scripts and ignore events with a detail of NotifyInferior.
  1046. Check the Xlib documentation for Enter/Leave events for complete
  1047. information on the detail field.
  1048.  
  1049. ------------------------------
  1050.  
  1051. From: -II-  Tk Questions and Answers - How can I:
  1052. Subject: -Q2.C.7- mix interactions between Xt and Tk/Tcl?
  1053.  
  1054. A2.C.7.
  1055.  
  1056. [From YIP Chi Lap [Beta] <h9118101@hkuxa.hku.hk> ]
  1057.     I have come up with a CPU hogging polling loop that
  1058. works (till now) for my application which not much
  1059. direct interaction between a Tk window and an Xt window is made.
  1060. (e.g., it won't draw something on a Tk window by a Xt-dispatched routine)
  1061.  
  1062.   XEvent xevent;
  1063.   for (;;)
  1064.   {
  1065.     if (XtAppPending(appcontext))
  1066.     {
  1067.       XtAppNextEvent(appcontext,&xevent);
  1068.       XtDispatchEvent(&xevent);
  1069.     }
  1070.     Tk_DoOneEvent(TK_DONT_WAIT);
  1071.   }
  1072.  
  1073. [ From David C Mudie <mudie@radon.eecs.berkeley.edu> ]
  1074.     We use the main event loop below.  The basic idea
  1075. is to watch for events arriving from either the Xt server
  1076. connection or the Tk server connection and then call
  1077. the library dispatchers.
  1078.  
  1079.     The code fragment below will need to be cleaned up for
  1080. your usage; there are some missing include statements
  1081. and global declarations buried elsewhere in the file.
  1082.  
  1083. /* Allow Tcl/Tk and Xt to work at the same time. */
  1084. void tkGo(void)
  1085. {
  1086.   extern Widget topLevel;
  1087.   int width = ulimit(4, -1);
  1088.   fd_set readfds;
  1089.   struct timeval timeout;
  1090.   int nfds;
  1091.   int tkfd = ConnectionNumber(Tk_Display(mainWindow));
  1092.   int xtfd = ConnectionNumber(XtDisplay(topLevel));
  1093.  
  1094.   Tcl_VarEval(interp, "update", NULL);
  1095.   while (1) {
  1096.  
  1097.     /* Select on X server connections to wait for event. */
  1098.     /* Timeout every half second to allow processing of non-X events */
  1099.  
  1100.     FD_ZERO(&readfds);
  1101.     FD_SET(tkfd, &readfds);
  1102.     FD_SET(xtfd, &readfds);
  1103.     timeout.tv_sec = 0;
  1104.     timeout.tv_usec = 500000;
  1105.  
  1106.     nfds = select(width, &readfds, NULL, NULL, &timeout);
  1107.     if (nfds < 0 && errno != EINTR) {
  1108.       perror("select");
  1109.     } else if (nfds == 0) {
  1110.       /* printf("timeout\n"); */
  1111.     }
  1112.  
  1113.     while (XtPending()) {
  1114.       XtProcessEvent(XtIMAll);
  1115.     }
  1116.  
  1117.     while (Tk_DoOneEvent(1)) {
  1118.       /* do nothing */
  1119.     }
  1120.   
  1121.     if (mainWindow == NULL) {
  1122. //      Tcl_DeleteInterp(interp);
  1123. //      Tcl_DStringFree(&command);
  1124.       Tcl_Eval(interp, "exit");
  1125.       return;
  1126.     }
  1127.   }
  1128. }
  1129.  
  1130. [ From Davide Frisoni <frisoni@faw.uni-ulm.de> ]
  1131.     One may use Xt properties to communicate between different
  1132. applications.
  1133.  
  1134. ------------------------------
  1135.  
  1136. From: -II-  Tk Questions and Answers - How can I:
  1137. Subject: -Q2.C.8- bind the ResizeRequest event?
  1138.  
  1139. A2.C.8.  huffi@dutncp8.tn.tudelft.nl (Martijn Figee Huffi Marcel Huefken)
  1140. says:
  1141.  
  1142. : I'm having trouble with...
  1143. :    bind .frame <ResizeRequest> {puts stdout "resise\n"}
  1144. : that is I can resize .frame and NEVER see "resize" at stdout.
  1145.  
  1146. Try 
  1147.         bind .frame <Configure> {puts...}
  1148.  
  1149. It'll work.
  1150.  
  1151. ------------------------------
  1152.  
  1153. From: -II-  Tk Questions and Answers - How can I:
  1154. Subject: -Q2.C.9- avoid that 'bad geometry "+0+0": expected widthxheight'
  1155.         error message?
  1156.  
  1157. A2.C.9.  This usually means that you have an X11 resource set that looks
  1158. like:
  1159.     *geometry: +0+0
  1160. or
  1161.     Tk*geometry: +0+0
  1162.  
  1163. Tk doesn't like this, so either remove it or fully specify the resource
  1164. in the form:
  1165.     widthxheight{+-}xoffset{+-}yoffset
  1166. such as
  1167.     Tk*geometry: 200x200+0+0
  1168.  
  1169. ------------------------------
  1170.  
  1171. From: -II-  Tk Questions and Answers - How can I:
  1172. Subject: -Q2.D.1- resize a listbox?
  1173.  
  1174. A2.D.1. Use wm min/maxsize - in a uniform manner.  Here is a resizable listbox:
  1175.  
  1176.         #!/usr/local/bin/wish -f
  1177.         wm minsize . 20 20
  1178.         wm maxsize . 1152 900
  1179.         pack append . [listbox .l -borderwidth 2 -relief raised] {expand fill}
  1180.  
  1181. Doing the same with the text widget brings its resizing under control too.
  1182.  
  1183. Thanks to "John C Ellson" <ellson@ontap.att.com).
  1184.  
  1185. ------------------------------
  1186.  
  1187. From: -II-  Tk Questions and Answers - How can I:
  1188. Subject: -Q2.D.2- select two items that are not adjacent in the listbox at 
  1189.         one time?
  1190.  
  1191. A2.D.2.  See Marc R. Ewing's Listbox.patch for a way to modify Tk to allow
  1192. selection of non-contiguous entries.
  1193.  
  1194. ------------------------------
  1195.  
  1196. From: -II-  Tk Questions and Answers - How can I:
  1197. Subject: -Q2.D.3- select items in more than one Tk listbox at a time?
  1198.  
  1199. A2.D.3. The default for Tk's listbox widget exports its selection as the
  1200. X selection.  There can only be one of these at a time.
  1201.  
  1202. To turn off this behavior in Tk, use the -exportselection false when
  1203. you create the listbox.  Or, use the
  1204.  
  1205. option add *Listbox.exportselection false
  1206.  
  1207. command in the beginning of your script.
  1208.  
  1209. Thanks to David Herron <david@davids.mmdf.com> for this tip.
  1210.  
  1211. ------------------------------
  1212.  
  1213. From: -II-  Tk Questions and Answers - How can I:
  1214. Subject: -Q2.D.4- avoid fractional white space at the end of a resizable
  1215.         listbox?
  1216.  
  1217. A2.D.4. First, let's state the problem more clearly. I want to make a
  1218. resizable listbox and I don't want to constrain it by setting a
  1219. minimum size. So I pack it with fill expand, I use it to set the grid
  1220. (so that resizing the window always gives me whole lines) and I set an
  1221. initial geometry of 1x1 to override the default. However what I get
  1222. is... (run the code below for a demo and try to resize)
  1223.  
  1224. listbox .l -geom 1x1 -setgrid 1 -yscrollcommand ".s set" -relief sunken -bd 2
  1225. scrollbar .s -command ".l yview"
  1226. pack .s -side right -fill y
  1227. pack .l -side top -fill both -expand 1
  1228. .l insert end one two three four five six seven eight nine ten "THE END"
  1229.  
  1230. ...a situation where the partially filled listbox has a blank
  1231. half-line at the bottom even if there are more items in the list. This
  1232. is very confusing because it fools the user into thinking that there
  1233. is nothing else beyond what's visible. Why does it happen?
  1234.  
  1235. Now for the answer.
  1236.     Look at the window as it is created, before the resizing. See that
  1237. poor, tiny little scrollbar squeezed in that microscopic window? It,
  1238. too, requests a minimum size, and it so happens that the starting
  1239. geometry for the listbox (i.e. the situation referred to as "1x1")
  1240. receives some free fractional space at the bottom. And you never get
  1241. rid of it, since the resizing is constrained to be in whole
  1242. characters.
  1243.  
  1244. The thing to do is to define the initial layout in such a way that the
  1245. widget that has -setgrid actually displays an integer number of lines
  1246. and columns. In the above example, setting -geom 1x2 does the trick.
  1247.  
  1248. Thanks to Frank Stajano <fms@cam-orl.co.uk> for this tip.
  1249.  
  1250. ------------------------------
  1251.  
  1252. From: -II-  Tk Questions and Answers - How can I:
  1253. Subject: -Q2.D.5- scroll two listboxes with one scrollbar?
  1254.  
  1255. A2.D.5. Scrollbars have a '-command' option which is used to tell
  1256. scrollable widgets (e.g. listbox, text, entry) how to position
  1257. themselves when the scrollbar is moved.  This command typically
  1258. looks like:
  1259.     scrollbar .scroll -command {.scrollable_widget yview}
  1260. or
  1261.     scrollbar .scroll -command {.scrollable_widget xview}
  1262.  
  1263. Before the command is executed, however, it will have a space and
  1264. a number appended to it.  The number is a logical position index
  1265. which indicates how the scrollable widget should position itself.
  1266. Thus, to have a single scrollbar control two (or more) widgets,
  1267. simply use a procedure as the scroll command, and have that
  1268. procedure scroll as many widgets as you would like.  The procedure
  1269. should take a single argument (i.e. the logical position index).
  1270. For example:
  1271.  
  1272.     proc ScrollCommand {index} {
  1273.         .lb1 yview $index
  1274.         .lb2 yview $index
  1275.         .lb3 yview $index
  1276.     }
  1277.  
  1278.     scrollbar .scroll -command ScrollCommand
  1279.  
  1280.     listbox .lb1 -geometry 4x5 -yscrollcommand {.scroll set}
  1281.     listbox .lb2 -geometry 4x5 -yscrollcommand {.scroll set}
  1282.     listbox .lb3 -geometry 4x5 -yscrollcommand {.scroll set}
  1283.     pack .scroll .lb1 .lb2 .lb3 -side left -fill y
  1284.  
  1285.     .lb1 insert 0 a b c d e f g h i j
  1286.     .lb2 insert 0 0 1 2 3 4 5 6 7 8 9
  1287.     .lb3 insert 0 A B C D E F G H I J
  1288.  
  1289.  
  1290. ------------------------------
  1291.  
  1292. From: -II-  Tk Questions and Answers - How can I:
  1293. Subject: -Q2.E.1- get output from a Tk canvas?
  1294.  
  1295. A2.E.1. The latest Tk has a save suboption on canvas which allows one
  1296. to create a file describing the canvas.  The default output is Encapsulated
  1297. Postscript, but there is an xpm3 suboption as well.
  1298.  
  1299. ------------------------------
  1300.  
  1301. From: -II-  Tk Questions and Answers - How can I:
  1302. Subject: -Q2.E.2- fill a canvas which is bounded by lines as opposed to a
  1303.         shape like a polygon, oval, etc.?
  1304.  
  1305. A2.E.2. No, you have to at least use a polygon if you want to fill an area
  1306. bounded by some lines.
  1307.  
  1308. ------------------------------
  1309.  
  1310. From: -II-  Tk Questions and Answers - How can I:
  1311. Subject: -Q2.E.3- raise/lower canvas window objects or draw graphics onto a 
  1312.         window object inside a canvas?
  1313.  
  1314. A2.E.3. You can't yet. 
  1315.  
  1316. "Jesper Blommaskog" <d9jesper@dtek.chalmers.se>.
  1317.  
  1318. ------------------------------
  1319.  
  1320. From: -II-  Tk Questions and Answers - How can I:
  1321. Subject: -Q2.E.4- detect when the canvas has been resized?
  1322.  
  1323. A2.E.4. From Nathaniel Pryce <np@hpl.hp.co.uk>:
  1324.  
  1325. > I have a window with a canvas containing some stuff that logically
  1326. > fills the canvas (say, a chess board or a map of the world). I want
  1327. > this toplevel window to be resizable and of course, when the win is
  1328. > resized, I want the stuff inside the canvas to be scaled
  1329. > accordingly. Now, I can manage the scaling of the stuff, but what
  1330. > I'm having trouble with is DETECTING that I should do it. How can I
  1331. > be notified that the window has been resized?
  1332.  
  1333. Nat's answer is:
  1334.  
  1335. You need to bind a command to the Configure event, like this:
  1336.  
  1337.     proc config {w h} {
  1338.        puts stdout ".canvas - width = $w, height = $h"
  1339.     }
  1340.  
  1341.     bind .canvas <Configure> "config %w %h"
  1342.  
  1343.  
  1344. .canvas - width = 224, height = 251
  1345. .canvas - width = 224, height = 151
  1346. .canvas - width = 224, height = 243
  1347. # and so forth
  1348.  
  1349. ------------------------------
  1350.  
  1351. From: -II-  Tk Questions and Answers - How can I:
  1352. Subject: -Q2.E.5- scroll a canvas an a listbox at the same time with 
  1353.         one scrollbar?
  1354.  
  1355. A2.E.5. From "David Herron" <david@twg.com>:
  1356.  
  1357. You need to write different code to handle the scrollcommand's.  Look at the
  1358. man page for `scrollbar' (and `listbox') and you see that it appends some
  1359. numbers to the scrollcommand such that your scrollbar command is executed as:
  1360.  
  1361.     .f.c yview; .f.lb yview <offset>
  1362.  
  1363. What I ended up doing is appended.  This code has an advantage in that
  1364. scrolling is constrained to "look right".
  1365.  
  1366.     listbox .l1    -relief sunken -yscrollcommand {
  1367.             scrollMultiple_y { .l1 .l2 .l3 } .vs
  1368.         }
  1369.     listbox .l2    -relief sunken -yscrollcommand {
  1370.             scrollMultiple_y { .l1 .l2 .l3 } .vs
  1371.         }
  1372.     listbox .l3    -relief sunken -yscrollcommand {
  1373.             scrollMultiple_y { .l1 .l2 .l3 } .vs
  1374.         }
  1375.     scrollbar .vs    -relief sunken -orient vertical \
  1376.             -command {setMultiple_y {.l1 .l2 .l3}}
  1377.  
  1378.     bind .l1 <1> {
  1379.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1380.     }
  1381.     bind .l1 <B1-Motion> {
  1382.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1383.     }
  1384.     bind .l1 <Shift-1> {
  1385.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1386.     }
  1387.     bind .l1 <Shift-B1-Motion> {
  1388.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1389.     }
  1390.  
  1391.     bind .l2 <1> {
  1392.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1393.     }
  1394.     bind .l2 <B1-Motion> {
  1395.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1396.     }
  1397.     bind .l2 <Shift-1> {
  1398.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1399.     }
  1400.     bind .l2 <Shift-B1-Motion> {
  1401.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1402.     }
  1403.  
  1404.     bind .l3 <1> {
  1405.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1406.     }
  1407.     bind .l3 <B1-Motion> {
  1408.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1409.     }
  1410.     bind .l3 <Shift-1> {
  1411.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1412.     }
  1413.     bind .l3 <Shift-B1-Motion> {
  1414.         selectMultiple {.l1 .l2 .l3} [%W nearest %y]
  1415.     }
  1416.  
  1417. proc scrollMultiple_y {lists vs total window first last} {
  1418.     if {[expr $first+$window] > $total} {
  1419.         set first [expr $total-$window]
  1420.         set last  [expr $first+$window]
  1421.     }
  1422.     setMultiple_y $lists $first
  1423.     $vs set $total $window $first $last
  1424. }
  1425. proc setMultiple_y  {lists index} {
  1426.     foreach l $lists { $l yview $index }
  1427. }
  1428. proc selectMultiple {lists index} {
  1429.     foreach l $lists { $l select from $index }
  1430. }
  1431.  
  1432. ------------------------------
  1433.  
  1434. From: -II-  Tk Questions and Answers - How can I:
  1435. Subject: -Q2.F.1- get the name of my own interpreter?
  1436.  
  1437. A2.F.1. george.howlett@att.com (George A. Howlett) points us to the winfo manual
  1438. page - winfo name . gets the name of the current application.
  1439.  
  1440. ------------------------------
  1441.  
  1442. From: -II-  Tk Questions and Answers - How can I:
  1443. Subject: -Q2.F.2- get -relief to work on my text widgets?
  1444.  
  1445. A2.F.2. From Owen Rees <rtor@ansa.co.uk>, we find out that we must:
  1446.  
  1447. "[m]ake the border width non-zero as in"
  1448.  
  1449.    text .t -width 20 -height 20 -relief sunken -borderwidth 4
  1450.  
  1451. ------------------------------
  1452.  
  1453. From: -II-  Tk Questions and Answers - How can I:
  1454. Subject: -Q2.F.3- create a scrollable window of buttons?
  1455.  
  1456. A2.F.3. There are at least two ways to do this.  First, there is a hypertext
  1457. widget that one can get from the Tcl User Contributed Code Archive -
  1458. (see "tcl-faq/part4") and (see "tcl-faq/part5") for details -
  1459.  which provides such a facility.
  1460.  
  1461. And here is some sample code from 
  1462. "Michael Moore" <mdm@stegosaur.cis.ohio-state.edu> which shows a way to 
  1463. do this using just Tk.
  1464.  
  1465. #! /bin/wish -f
  1466. #
  1467. # This demonstrates how to create a scrollable canvas with multiple
  1468. # buttons.
  1469. #
  1470. # Author : Michael Moore
  1471. # Date   : November 17, 1992
  1472. #
  1473.  
  1474. #
  1475. # This procedure obtains all the items with the tag "active"
  1476. # and prints out their ids.
  1477.  
  1478. proc multi_action {} {
  1479.     set list [.frame.canvas find withtag "active"]
  1480.     puts stdout "Active Item Ids : "
  1481.     foreach item $list {
  1482.     puts stdout $item
  1483.     }
  1484. }
  1485.  
  1486. # This simulates the toggling of a command button...
  1487. # Note that it only works on a color display as is right now
  1488. # but the principle is the same for b&w screens.
  1489. proc multi_activate {num id} {
  1490.     
  1491.     set tags [.frame.canvas gettags $id]
  1492.     if {[lsearch $tags "active"] != -1} {
  1493.     .frame.canvas dtag $id "active"
  1494.     .frame.canvas.button$num configure \
  1495.         -background "#060" \
  1496.         -activebackground "#080" 
  1497.     } else {
  1498.     .frame.canvas addtag "active" withtag $id
  1499.     .frame.canvas.button$num configure \
  1500.         -background "#600" \
  1501.         -activebackground "#800"
  1502.     }
  1503.  
  1504. proc setup {} {
  1505.      frame .frame
  1506.  
  1507.      scrollbar .frame.scroll \
  1508.          -command ".frame.canvas yview" \
  1509.          -relief raised
  1510.  
  1511.      canvas .frame.canvas \
  1512.          -yscroll ".frame.scroll set" \
  1513.          -scrollregion {0 0 0 650} \
  1514.          -relief raised \
  1515.      -confine false \
  1516.      -scrollincrement 25
  1517.  
  1518.      pack append .frame \
  1519.          .frame.scroll    {left frame center filly} \
  1520.          .frame.canvas    {left frame center fillx filly}
  1521.  
  1522.      pack append .\
  1523.          .frame   {left frame center fillx filly}
  1524.  
  1525.      button .frame.canvas.action  \
  1526.          -relief raised \
  1527.          -text "Action" \
  1528.      -command "multi_action"
  1529.      .frame.canvas create window 1 25 \
  1530.      -anchor w \
  1531.          -window .frame.canvas.action
  1532.      for {set i 2} {$i < 26} {incr i} {
  1533.      button .frame.canvas.button$i  \
  1534.         -relief raised \
  1535.         -background "#060" \
  1536.         -foreground wheat \
  1537.         -activebackground "#080" \
  1538.         -activeforeground wheat \
  1539.         -text "Button $i" 
  1540.      set id [.frame.canvas create window 1 [expr $i*25] \
  1541.         -anchor w \
  1542.         -window .frame.canvas.button$i]
  1543.      .frame.canvas.button$i configure \
  1544.         -command "multi_activate $i $id"
  1545.     }
  1546. }
  1547.  
  1548. setup
  1549.  
  1550. ------------------------------
  1551.  
  1552. From: -II-  Tk Questions and Answers - How can I:
  1553. Subject: -Q2.F.4- pack a text widget so that it can be resized interactively?
  1554.  
  1555. A2.F.4. From Spencer W. Thomas <spencer@med.umich.edu> we find that we need to:
  1556.  
  1557. wm minsize . 0 0
  1558. text .text
  1559. pack append . .text {fill expand}
  1560.  
  1561. ------------------------------
  1562.  
  1563. From: -II-  Tk Questions and Answers - How can I:
  1564. Subject: -Q2.F.5- create a widget with an upper case name?
  1565.  
  1566. A2.F.5. During a recent revision of Tk, things were changed so that names
  1567. beginning with a capital letter are reserved for class names.  Specific
  1568. instances of widgets must begin with a lower case letter.  This enables
  1569. X11 resource definitions to distinguish between a class and instance.
  1570.  
  1571. ------------------------------
  1572.  
  1573. From: -II-  Tk Questions and Answers - How can I:
  1574. Subject: -Q2.F.6- create equal sized buttons?
  1575.  
  1576. A2.F.6. Recently, Micael Salmon <etxmesa@eos.ericsson.se> posted:
  1577.  
  1578. In article <1993Jun23.065417.4302@ericsson.se>, I write:
  1579. |> I am currently working on yet another tn3270 emulator and I have run
  1580. |> into a problem with creating equal sized buttons. I have created an
  1581. |> array of buttons for PF and cursor keys and I would now like to make
  1582. |> them all the same size. Arranging them into columns was not
  1583. |> a problem but when I add bitmaps the buttons lose their horizontal
  1584. |> alignment. What I tried was to read the height and width of the buttons
  1585. |> using winfo, determine the largest and then use pads to force them to
  1586. |> be the same size, this doesn't seem to work. The technique of using
  1587. |> pre-set height and width doesn't seem applicable when using a mixture
  1588. |> of bitmaps and text as the size in pixels of a text button is font
  1589. |> dependent. All suggestions welcome.
  1590.  
  1591. Jim Wight <J.K.Wight@newcastle.ac.uk> suggested using reqheight and reqwidth
  1592. and then specifying padx and pady in the pack command for each button.
  1593. Jim says:
  1594. I think it only fair to point out that it was Tuomas J Lukka
  1595. <lukka@klaava.Helsinki.FI> who suggested the use of reqwidth and reqheight when I asked how to get over the deficiencies in my first attempt at a solution
  1596. that I posted to this group.
  1597.  
  1598. Since you're all agog I might as well post the final solution (more or less)
  1599. that I mailed to Michael.
  1600.  
  1601. frame .frame1
  1602. frame .frame2
  1603. button .frame1.a -text "pretty long button text"
  1604. button .frame1.b -text "short one"
  1605. button .frame2.c -bitmap "@/usr/include/X11/bitmaps/xlogo32"
  1606. button .frame2.d -text "tiny"
  1607.  
  1608. set long [winfo reqwidth .frame1.a]
  1609. set short [winfo reqwidth .frame1.b]
  1610. set medium [winfo reqwidth .frame2.c]
  1611. set tiny [winfo reqwidth .frame2.d]
  1612. set pady [expr [winfo reqheight .frame2.c]-[winfo reqheight .frame2.d]]
  1613.  
  1614. pack append .frame1 .frame1.a "filly pady $pady"
  1615. pack append .frame1 .frame1.b "fillx padx [expr $long-$short] filly pady $pady"pack append .frame2 .frame2.c "fillx padx [expr $long-$medium] filly"
  1616. pack append .frame2 .frame2.d "fillx padx [expr $long-$tiny] filly pady $pady"
  1617. pack append . .frame1 {left} .frame2 {left}
  1618.  
  1619. ------------------------------
  1620.  
  1621. From: -II-  Tk Questions and Answers - How can I:
  1622. Subject: -Q2.F.7- vertically stack radio buttons aligning regardless of font?
  1623.  
  1624. A2.F.7.  Till Brychcy <brychcy@informatik.tu-muenchen.de> provides
  1625. the following example:
  1626.  
  1627.     radiobutton .times -text Times -anchor w
  1628.     radiobutton .helvetica -text Helvetica -anchor w
  1629.     radiobutton .courier -text Courier -anchor w
  1630.     pack .times .helvetica .courier -side top -fill x
  1631.  
  1632. Note that you are using anchor west in the widgets themselves, and not in
  1633. the packer.  This lets the packer produce full width buttons.
  1634.  
  1635. ------------------------------
  1636.  
  1637. From: -II-  Tk Questions and Answers - How can I:
  1638. Subject: -Q2.F.8- initialize an entry widget with some text?
  1639.  
  1640. A2.F.8.  kesch@kappco.kapp-coburg.de (Peter Kesch) provides us with
  1641. one example:
  1642.  
  1643. set default "foobar"
  1644. entry .foo -width 25 -state disabled -textvariable default
  1645.  
  1646. ------------------------------
  1647.  
  1648. From: -II-  Tk Questions and Answers - How can I:
  1649. Subject: -Q2.F.9- change the default colors in Tk?
  1650.  
  1651. A2.F.9.  To change the default colors in Tk you must modify your X
  1652. resource database.  You can do this using whatever method you ususally
  1653. use to add/modify X resources (X default file, etc.), or you can use
  1654. the Tk "option" command to change the option database from within a Tk
  1655. application.  rpeck@java.nas.nasa.gov (Rodney C. Peck) lists the set
  1656. of resources which must be set along with a possible color scheme:
  1657.  
  1658.      Tk*activeBackground:                    #efefef
  1659.      Tk*activeForeground:                    black
  1660.      Tk*selector:                            black
  1661.      Tk*background:                          #dfdfdf
  1662.      Tk*foreground:                          black
  1663.      Tk*selectBackground:                    #bfdfff
  1664.      Tk*Scale.activeForeground:              #efefef
  1665.      Tk*Scale.sliderForeground:              #dfdfdf
  1666.      Tk*Scrollbar.foreground:                #dfdfdf
  1667.      Tk*Scrollbar.activeForeground:          #efefef
  1668.      Tk*Button.disabledForeground:           #7f7f7f
  1669.      Tk*Checkbutton.disabledForeground:      #7f7f7f
  1670.      Tk*Radiobutton.disabledForeground:      #7f7f7f
  1671.      Tk*Menu.disabledForeground:             #7f7f7f
  1672.  
  1673. For more information, see your system's documentation for loading
  1674. X resources, and/or the Tk man page for the "option" command.
  1675.  
  1676. ------------------------------
  1677.  
  1678. From: -II-  Tk Questions and Answers - How can I:
  1679. Subject: -Q2.F.10- find my invisible windows when using the packer?
  1680.  
  1681. A2.F.10.  The situation:
  1682.   A window is created, say .w1, followed by another window, say .w2.
  1683.   The command "pack .w1 -in -.w2" is used to pack .w1 inside of .w2.
  1684.   The pack command completes successfully, and "pack newinfo .w1"
  1685.   indicates that things are as expected.  However, .w1 isn't visible!
  1686.   Where is it?
  1687.             button .w1 -text button;   # create .w1
  1688.             frame .w2;                 # create .w2
  1689.             pack .w1 -in .w2;          # pack .w1 inside .w2 
  1690.             pack .w2;                  # pack .w1 in main window
  1691.                                        # where's the button?
  1692.  
  1693.   The explanation:
  1694.   (based on a posting by js@aelfric.bu.edu (Jay Sekora))
  1695.  
  1696.   The short answer is "raise .w1".  In the example .w1 is positioned
  1697.   properly inside .w2, and all the sizing glue that lets .w1 and .w2
  1698.   adjust their sizes based on each other will work, but .w1 is
  1699.   _underneath_ .w2, because windows are stacked in the order they're
  1700.   created in, by default.  You can change the stacking order
  1701.   explicitly with the "raise" command, in this case "raise .w1".
  1702.  
  1703. ------------------------------
  1704.  
  1705.  
  1706. End of comp.lang.tcl Tk Toolkit Usage Questions and Answers (1/1)
  1707. *****************************************************
  1708. -- 
  1709. --------------------------------------
  1710. Thomas J. Accardo          tja@cpu.com
  1711. Computerized Processes Unlimited, Inc.
  1712. Metairie, LA
  1713.  
  1714.